package com.org.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.org.pojo.CommunityAdmin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * ClassName: CommunityUserMapper
 * Package: com.org.mapper
 * Description:
 *
 * @Author Origin
 * @Create 2024/2/3 0:04
 * @Version 1.0
 */

@Mapper
public interface CommunityAdminMapper extends BaseMapper<CommunityAdmin> {

    @Select("select * from community_admin where username=#{username}")
    CommunityAdmin findByUsername(String username);

    @Update("update community_admin set phone=#{phone}, update_time=now() where id=#{id}")
    void update(CommunityAdmin communityAdmin);

    @Update("update community_admin set state=#{state}, update_time=now() where username=#{username}")
    void updateState(String state, String username);

    @Update("update community_admin set community_id=#{communityId}, update_time=now() where id=#{communityAdminId}")
    void updateCommunityId(Integer communityId, Integer communityAdminId);

    @Update("update community_admin set user_pic=#{url}, update_time=now() where id=#{id}")
    void updateAvatar(String url, Integer id);

    @Update("update community_admin set password=#{newPwd}, update_time=now() where id=#{id}")
    void updatePwd(String newPwd, Integer id);


}
